/* 
 * File:   ebookpage.h
 * Author: Luis Aguirre
 * Description: Represents a page of an ebook
 *
 * Created on jule 16, 2013, 05:35 PM
 */

#ifndef EBOOKPAGE_H
#define	EBOOKPAGE_H

#include <string>
#include <list>
#include <stdio.h>
#include <algorithm>

#define PAGE_BREAK "<<#>>"

struct EBookPage
{
public:
    
    /**
     * Constructor that initialize the page number in 0.
     */
    EBookPage() : number(0)
    {
    }
    
    /**
     * Constructor copy.
     * 
     * @param other Another EBookPage
     */
    EBookPage(const EBookPage& other);
    
    /**
     * Destructor.
     */
    ~EBookPage();
    
    /**
     * Add a new line in the page.
     * 
     * @param line Line that will be added
     * 
     * @return True of the line was added
     */
    bool addLine(const std::string& line);
    
    /**
     * Show the page in console.
     */
    void printPage()
    {
        printf("%s\n", data.c_str());
    }
    
    std::string getContent();
    
    bool containsWord(std::string word);
    
    /**
     * Page number.
     */
    int number;
    
    /**
     * Data of the page.
     */
    std::string data;
};

#endif	/* EBOOKPAGE_H */
